<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
    <script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <![endif]-->
    <title></title>
</head>
<body>
<div class="contant">
<div class="row">
    <div class="top">财务部>GPS采购待审列表</div>
    <div class="content applylist">
        <div class="box">
            <h1>GPS采购待审列表</h1>
            <div class="list-block">
                <div class="row">
                    <table class="list">
                        <tr>
                            <th>申请人</th> <th>数量</th><th>状态</th> <th>供应商</th> <th>备注</th><th>操作</th>
                        </tr>
                            <foreach name="list" item="_gps" >
                        <tr>
                                <td>{$_gps.name}</td>
                                <td>{$_gps.total_stock}</td>
                                <td>
                                    <switch name="_gps.status">
                                        <case value="0">通过</case>
                                        <case value="1">草稿</case>
                                        <case value="2">待审</case>
                                        <case value="3">删除</case>
                                        <case value="4">申请设备待审</case>
                                        <case value="5">申请设备通过</case>
                                        <default />default
                                    </switch>
                                </td>
                                <td>{$_gps.suppliers}</td>
                                <td>{$_gps.note}</td>
                            <td><a class="check-through" data-id={$_gps.id} href="javascript:void(0);">同意</a></td>
                        </tr>
                            </foreach>
                    </table>
                </div>
                {$page}
            </div>
        </div>
    </div>
</div>
</div>
<script type="text/javascript">
    $('.check-through').click(function(elm){
        if (confirm('确定审核通过吗？') == true){
            var gpsId = $(this).attr('data-id');

            $.ajax({
                type: "POST",
                url: "__URL__/checkYes",
                data: {
                    gpsId:gpsId
                },
                success: function(msg){
                    console.log(msg);
                    if (msg) {
                        alert('已经审核通过，将加入库存');
                    }
                    window.location.reload();
               }
            });

        }
    });
</script>
</body>
</html>